package com.core.system.utils;

import com.pojo.entity.SystemUserEntity;

/**
 * @author Huawei
 * @date 2023-10-23 15:11
 */
public class SecurityUser {

    private static ThreadLocal<SystemUserEntity> threadLocal = new ThreadLocal<>();

    public static void setUser(SystemUserEntity systemUserEntity) {
        threadLocal.set(systemUserEntity);
    }

    public static SystemUserEntity getUser(SystemUserEntity systemUserEntity) {
       return threadLocal.get();
    }

    public static Long getUserId() {
        return threadLocal.get().getId();
    }

    public static String getUserName() {
        return threadLocal.get().getUserName();
    }
}
